package br.ufba.lasid.jitclouds.mda.utils;

import java.io.InputStream;
import java.util.Properties;

public final class MQProperties {

    public static final String HOST = "amqp.host";
    public static final String PORT = "amqp.port";
    public static final String SSL_PORT = "amqp.ssl_port";
    private static final String AMQP_PROPERTIES_RESOURCE_NAME = "amqp.properties";
    private static final Properties properties = new Properties();

    static {
        try {
            ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
            InputStream propStream = systemClassLoader
                    .getResourceAsStream(AMQP_PROPERTIES_RESOURCE_NAME);
            properties.load(propStream);
        } catch (Exception e) {
            System.err.println("Couldn't find ampq properties resource '"
                    + AMQP_PROPERTIES_RESOURCE_NAME + "': " + e.getMessage());
            System.exit(1);
        }
    }

    public static final String get(String propName) {
        return properties.getProperty(propName);
    }
}
